package com.qf.oop.dt;

/**
 * 矩形 （长方形）
 */
public class Rectangle extends Graphical{

    private int length; // 矩形的长度

    private int width; // 矩形宽度

    public Rectangle() {
    }

    public Rectangle(int length, int width) {
        this.length = length;
        this.width = width;
    }

    public int getLength() {
        return length;
    }

    public void setLength(int length) {
        this.length = length;
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    @Override
    public void printZC() {
        int perimeter = length * 2 + width * 2;
        System.out.println("矩形的周长为:"+perimeter);
    }

    @Override
    public void printArea() {
        int area = length * width;
        System.out.println("矩形的面积为:"+area);
    }
}
